#include "BetaNode.h"

#include <QDebug>
#include <math.h>
BetaNode::BetaNode(Node *alpha, Node *beta, double sampleValue, bool isObserved) :
    Node(BETA, sampleValue, isObserved),
    alpha(alpha),
    beta(beta)
{
    alpha->addChild(this);
    beta->addChild(this);
}

BetaNode::BetaNode(const BetaNode &other) :
    Node(other),
    alpha(other.alpha),
    beta(other.beta)
{
}

BetaNode::~BetaNode()
{

}

double BetaNode::logLikelihood(double x)
{
    return log(Distribution::sharedInstance()->likelihoodBeta(x, alpha->getLastSample(), beta->getLastSample()));
}
